<?php
require_once 'Core/Services/Abstract.php';

/**
 * Example class for sending a session back to ActionScript.
 */
class Core_Services_Session
	extends Core_Services_Abstract
{
	/**
	 * Creates a new session instances if it doesn't alread exists. If
	 * it does exist, regenerates the ID. Actual session construction
	 * is handled in the Abstract constructor- please be careful when
	 * you extend it.
	 * 
	 * @param $login String
	 * @param $password String
	 * @return string
	 */
	public function create ( $login, $password )
	{
		// Use the model to authenticate
		
		$result = $sessionModel->create( Core_User_Type::NATIVE, $login, $password, false );
		return $result;
	}
	
	/**
	 * Logs the user out.
	 * 
	 * @return Boolean
	 */
	public function destroy ()
	{
		Zend_Session::forgetMe();
		Zend_Session::destroy( true, true );
		return true;
	}
}
